<template>
  <div class="map_box">
    <!-- 顶部搜索标题 -->
    <div class="search">
      <div class="city">成都市 ﹀</div>
        <div class="button">
          <img style="width:36rpx;height:36rpx;margin-right: 12rpx;" src="../../../static/images/index/search.png" alt="">
          <input placeholder="搜索场馆">
        </div>
      <div class="img_box">
    </div>
    </div>

    <!-- 选项列表 -->
    <div class="select">
        <div
          :class="index == is_index ? 'active':''"
         class="select_box" v-for="(item, index) in selectList" :key="index" @click="click_type(index)">
          <img style="width:24rpx;height:24rpx;margin-right: 4rpx;" src="../../../static/images/index/lq.png" alt="">
          <div class="text">{{item.name}}</div>
        </div>
    </div>

    <!-- 弹出层 -->
    <div class="daion">
      <div class="venue">附近场馆</div>
      <div class="left">
        <img  @click="go_mapDetails" style="height:149rpx;width:181rpx; margin-right: 24rpx; border-radius: 15rpx;" src="https://tgi13.jia.com/125/454/25454038.jpg" alt="">
        <div>
            <div>XXX羽毛球馆</div>
            <div class="text1">
              <img style="height:22rpx;width:22rpx;" src="../../../static/images/index/dz.png" alt="">
              四川省成都市盛安街125号
            </div>
            <div class="text2">
              <span>可预约</span>
              <span class="c908">0.2km</span>
            </div>
            <div class="text3">
              ￥25.5<span>元/小时起</span>
        </div>
        </div>
      </div>
    </div>

    <!-- 地图容器 -->

    <div class="mapDiv">
      <map id="map" 
      :longitude="longitude" 
      :latitude="latitude" 
      :scale="scale" 
      :markers="markers" 
      :circles="comCircles"
      include-points
      show-location 
      @markertap="markertap"
      @controltap="controltap"
      @regionchange="regionChange"
      @begin="regionChangeBegin" 
      @end="regionChangeEnd"
      @tap="clicktap"
      @poitap="poitap"
      @updated="updated"
      ></map>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        selectList:[
          {name:'足球',url:''},
          {name:'篮球',url:''},
          {name:'羽毛球',url:''},
          {name:'乒乓球',url:''},
          {name:'网球',url:''},
          {name:'射箭',url:''},
          {name:'游泳',url:''},
          {name:'攀岩',url:''},
          ], // 标题数据
        is_index:0,// 激活样式定义
        latitude: '',//纬度
        longitude: '',// 经度
        markers: [{ //标记点
          iconPath: "/static/images/user/map.png",
          id: 1,
          latitude: 30.557619094848633,
          longitude: 104.05237579345703,
          zIndex: 99,
          width: 36,
          height: 47,
          title: "脑卫士店铺111",
          name: "脑卫士店铺111",
          address: "脑卫士店铺111",
        },{ //标记点
          iconPath: "/static/images/user/map.png",
          id: 2,
          latitude: 30.5702,
          longitude: 104.06476,
          zIndex: 99,
          width: 36,
          height: 47,
          title: "脑卫士店铺222",
          name: "脑卫士店铺222",
          address: "脑卫士店铺222",
        }],
        circles: [],
        // scale: 14,
      }
    },
    methods: {
      click_type(v) { // 激活样式切换
        this.is_index = v
      },
    },
    computed:{
      comCircles(){
        return this.circles
      }
    },
  }
</script>

<style scoped>
.map_box{
  width: 100%;
  height: 100%;
}
.map_box .search{
    width: 750rpx;
    height: 60rpx;
    display: flex;
    align-items: center;
    margin: 18rpx 0;
  }
  .city{
    width: 152rpx;
    height: 60rpx;
    text-align: center;
    line-height: 60rpx;
    font-size: 24rpx;
    font-family: PingFang SC;
    font-weight: 500;
    color: #000000;
  }
  .map_box .search .button{
    display: flex;
    align-items: center;
    width: 503rpx;
    height: 60rpx;
    background: #EEEEEE;
    box-shadow: 0px 3rpx 16rpx 2rpx rgba(255, 255, 255, 0.14);
    opacity: 0.9;
    border-radius: 30rpx;
    font-size: 30rpx;
    line-height: 60rpx;
    padding-left: 28rpx;
  }
  .img_box{
    width: 54rpx;
    height: 54rpx;
    background-image: url('../../../static/images/index/menu.png');
    background-size: cover;
    background-repeat: no-repeat;
    margin-left: 9rpx;
  }

  .select{
    width: 750rpx;
    height: 49rpx;
    display: flex;
    align-items: center;
    justify-content: space-around;
    /* border: 1px solid red; */
    box-sizing: border-box;
  }
  .select_box{
    
    height: 49rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 7rpx;
    padding: 5rpx;
    box-sizing: border-box;
  }
  .select_box .text{
    font-size: 18rpx;
    font-family: Source Han Sans CN;
    font-weight: 500;
    color: #6E6E6E;
  }
  .active{
    background: #31C57D;
    border-radius: 7rpx;
  }
  .active .text{
    color: #fff;
  }


  .daion{
    width: 694rpx;
    height: 279rpx;
    margin: 0 27rpx;
    background: #FFFFFF;
    box-shadow: 0rpx 3rpx 23rpx 1rpx rgba(9, 9, 9, 0.2);
    border-radius: 20rpx 20rpx 0rpx 0rpx;
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 10;
    bottom: 0;
  }
  .daion .venue{
    width: 694rpx;
    height: 71rpx;
    text-align: center;
    line-height: 60rpx;
    border-bottom: 1px solid #EEEEEE;
    
  }

  .daion .left{
    
    padding: 17rpx;
    box-sizing: border-box;
    width: 694rpx;
    flex: 1;
    background-color: #fff;
    display: flex;
  }
  .daion .left div:nth-child(1){
    font-size: 30rpx;
    font-family: Source Han Sans CN;
    font-weight: bold;
    color: #010101;
  }
   .daion .left .text1{
     display: flex;
     align-items: center;
     font-size: 24rpx;
      font-family: Source Han Sans CN;
      font-weight: bold;
      color: #908D8D;
  }
  .daion .left .text2 span:nth-child(1){
    font-size: 20rpx;
    font-family: Source Han Sans CN;
    font-weight: bold;
    color: #0EC173;
    display: inline-block;
    padding-right: 10rpx;
    border-right: 1px solid #908D8D;
  }
  .daion .left .text2 .c908{
    font-size: 20rpx;
    font-family: Source Han Sans CN;
    font-weight: bold;
    color: #908D8D;
    padding-left: 20rpx;
  }

    .daion .left .text3{
      font-size: 36rpx;
      font-family: Source Han Sans CN;
      font-weight: bold;
      color: #FE720C;
    }
    .daion .left .text3 span{
      font-size: 20rpx;
      font-weight: 500;
    }

  .mapDiv{
    background: #ccc;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-sizing: border-box;
    z-index: -1;
  }
  .mapDiv map{
    width: 100%;
    height: 100%;
  }
</style>